package org.jsola.hr.provider.impl;

import lombok.extern.slf4j.Slf4j;
import org.jsola.contract.query.ContractQuery;
import org.jsola.contract.service.IContractOverviewService;
import org.jsola.contract.vo.ContractListVO;
import org.jsola.contract.vo.ContractStatisticsEmpUnitsVO;
import org.jsola.core.Page;
import org.jsola.hr.provider.IContractOverviewProviderService;
import org.jsola.user.core.TokenUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wcl
 */
@Slf4j
@Service("hrIContractOverviewProviderServiceImpl")
public class IContractOverviewProviderServiceImpl implements IContractOverviewProviderService {

    @Autowired
    private IContractOverviewService contractOverviewService;

    @Override
    public Page<ContractStatisticsEmpUnitsVO> selectComForRankCount(ContractQuery contractQuery, TokenUser tokenUser) {
        return contractOverviewService.selectComForRankCount(contractQuery, tokenUser.getSiteId());
    }

    @Override
    public List<ContractStatisticsEmpUnitsVO> selectComForRankCountList(TokenUser tokenUser) {
        return contractOverviewService.selectComForRankCountList(tokenUser.getSiteId());
    }

    @Override
    public Page<ContractListVO> selectPageContract(ContractQuery contractQuery, TokenUser tokenUser) {
        Page<ContractListVO> listVOPage = contractOverviewService.selectPage(contractQuery, tokenUser.getSiteId());
        return listVOPage.to(ContractListVO.class);
    }

    @Override
    public Page<ContractListVO> selectPageBySubjectIds(ContractQuery contractQuery, String siteId) {
        Page<ContractListVO> listVOPage = contractOverviewService.selectPageBySubjectIds(contractQuery, siteId);
        return listVOPage.to(ContractListVO.class);
    }
}
